<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{$CONF['mallTitle']}后台管理中心</title>
    <link href="__PUBLIC__/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/plugins/jedate/skin/jedate.css" rel="stylesheet">
    <link href="__CSS__/AdminLTE.css" rel="stylesheet" type="text/css" />
    <!--[if lt IE 9]>
    <script src="__PUBLIC__/js/html5shiv.min.js"></script>
    <script src="__PUBLIC__/js/respond.min.js"></script>
    <![endif]-->
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script src="__PUBLIC__/plugins/jedate/jquery.jedate.min.js"></script>
    <script src="__PUBLIC__/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/js/common.js"></script>
    <script src="__PUBLIC__/plugins/plugins/plugins.js"></script>

</head>

<body class='wst-page'>
<div class='wst-tbar' style='text-align:right;height:25px;'>
    <php>if(in_array('spfl_01',$WST_STAFF['grant'])){</php>
    <a class="btn btn-info glyphicon glyphicon-download-alt" href="javascript:ExportSelected(5)" style='float:right'>销售排行统计报表下载</a>
    <php>}</php>
</div>
<form action="{:U("Admin/Stats/tjph")}" method="post">
    开始时间:<input class="datainp wicon " id="inpstart" type="text" placeholder="包含" name="startDate" value="<?php echo $startDate?$startDate:''; ?>" readonly>
    结束时间:<input class="datainp wicon" id="inpend" type="text" placeholder="不包含"  name="endDate" value="<?php echo $endDate?$endDate:''; ?>" readonly>
<button type="submit" class="btn btn-primary glyphicon glyphicon-search">查询</button>
</form>
<br/>
<div class='wst-body'>
    <table class="table table-hover table-striped table-bordered wst-list">
        <thead>
        <tr>
            <th width='30'>排行</th>
            <th width='40'>商品名称</th>
            <th width='40'>货号</th>
            <th width='40'>销售量</th>
            <th width='40'>销售额</th>
            <th width='40'>均价</th>
        </tr>
        </thead>
        <tbody id="ajaxHtml">
        <?php $number = $page*$pageSize-($pageSize-1); ?>
        <volist name="lists" id="vo" key='i'>
            <tr>
                <td>{$number++}</td>
                <td >{$vo['goodsName']}</td>
                <td>{$vo['goodsId']}</td>
                <td>{$vo['goodsCount']}</td>
                <td>{$vo['sum']}元</td>
                <td><?php echo number_format($vo['avg'],2);?>元</td>
            </tr>
        </volist>
        </tbody>
        <tr>
            <td colspan='10' align='center'>{$pageres}</td>
        </tr>
    </table>
</div>
</body>
<script type="text/javascript">
    var start = {
        format: 'YYYY-MM-DD ',
        minDate: '2014-06-16 23:59:59', //设定最小日期为当前日期
        //festival:true,
        //isinitVal:true,
        maxDate: $.nowDate(0), //最大日期
        choosefun: function(elem,datas){
            end.minDate = datas; //开始日选好后，重置结束日的最小日期
        }
    };
    var end = {
        format: 'YYYY-MM-DD ',
        minDate: $.nowDate(0), //设定最小日期为当前日期
        //festival:true,
        //isinitVal:true,
        maxDate: '2099-06-16 23:59:59', //最大日期
        choosefun: function(elem,datas){
            start.maxDate = datas; //将结束日的初始值设定为开始日的最大日期
        }
    };
    $("#inpstart").jeDate(start);
    $("#inpend").jeDate(end);

    //导出所选
    function ExportSelected(status){
        var params = {};
        params.startDate=$("#inpstart").val();
        params.endDate=$("#inpend").val();
        params.status = status;
        var jsonText = JSON.stringify(params);
        location.href="__CONTROLLER__/outExcel/data/"+jsonText;
    }

</script>
</html>